/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufc.so.st.ui;

import javax.swing.JLabel;
import javax.swing.UIManager;

/**
 *
 * @author italopessoa
 */
public class jfrmUIProdutorConsumidor extends javax.swing.JFrame {
//lblLigDes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/autoalarm/ui/img/desliga.png")));
    /**
     * Creates new form UIProdutorConsumidor
     */
    private int valor;
    
    public jfrmUIProdutorConsumidor() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setText("Produtor Consumidor");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(269, 6, -1, -1));

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sincronizarthreads/ui/images/produtor.jpg"))); // NOI18N
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 36, -1, -1));

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sincronizarthreads/ui/images/consumidor.jpg"))); // NOI18N
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(379, 36, 306, 359));

        jButton1.setText("Ilimitado");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 480, -1, -1));

        jButton2.setText("Demanda");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 480, -1, -1));
        getContentPane().add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 520, 79, -1));

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sincronizarthreads/ui/images/on.png"))); // NOI18N
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(143, 413, -1, -1));

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sincronizarthreads/ui/images/on.png"))); // NOI18N
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(537, 413, -1, -1));
        getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 443, 690, -1));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if(valor == 1)
            //System.err.println("valor é 1");
            this.valor = 2;
        else
            //System.err.println("valor nao é 1");
            this.valor = 1;
            
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
alterProdutorStatus(1);        
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        String nativeLF = UIManager.getSystemLookAndFeelClassName();
        try {
            //for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            //  if ("Nimbus".equals(info.getName())) {
            javax.swing.UIManager.setLookAndFeel(nativeLF);
            //}
            //}
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(jfrmUIProdutorConsumidor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(jfrmUIProdutorConsumidor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(jfrmUIProdutorConsumidor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(jfrmUIProdutorConsumidor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new jfrmUIProdutorConsumidor().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables

    public static void alterProdutorStatus(int status){
        //jfrmUIProdutorConsumidor a = new jfrmUIProdutorConsumidor();
        //a.setStatusProdutor(1);
    }
    
    private void setStatusProdutor(int status){
        //this.jLabel4 = new JLabel();
        if(status == 0){
            this.jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/autoalarm/ui/img/desliga.png")));
        }else{
            this.jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sincronizarthreads/ui/images/off.png")));
        }
    }
}
